package gui_TJCPS;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class PainelAjuda extends JPanel implements ActionListener{

	private JButton botaoVoltar;
	private JanelaPrincipal janelaPrincipal;
	public PainelAjuda(JanelaPrincipal janela) {
		super();
		this.setLayout(null);
		this.janelaPrincipal = janela;
		this.botaoVoltar = new JButton(new ImageIcon(getClass().getResource("/imagens/botaoVoltarTelaAjuda.png")));
		this.botaoVoltar.setBounds(400, 700, this.botaoVoltar.getIcon().getIconWidth(), this.botaoVoltar.getIcon().getIconHeight());
		this.botaoVoltar.addActionListener(this);
		this.botaoVoltar.setVisible(true);
		this.add(this.botaoVoltar);
	}
	
	
	@Override  
	public void paintComponent(Graphics g) {  
		super.paintComponent(g);  
		Image imagem = (new ImageIcon(getClass().getResource("/imagens/telaAjuda.png"))).getImage(); 
		if (imagem != null)  
			g.drawImage(imagem, 0, 0, this);  
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		if(arg0.getSource() == this.botaoVoltar){
			this.janelaPrincipal.acaoBotaoAjuda();
		}
		
	}

}
